package com.cq.service.impl;

import com.cq.mapper.ReplyMapper;
import com.cq.pojo.Reply;
import com.cq.service.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 悠久的苍穹
 * @Date: 2021/2/5 19:17
 * @Description: ${description}
 * @Version: 1.0
 */
@Service
public class ReplyServiceImpl implements ReplyService {

    @Autowired
    ReplyMapper replyMapper;

    @Override
    public int getCount() {
        return replyMapper.getCount();
    }

    @Override
    public List<Reply> getReplies(int page, int limit) {
        return replyMapper.getReplies((page-1)*limit,limit);
    }

    @Override
    public int getReplyCount(String start, String end) {
        return replyMapper.getReplyCount(start,end);
    }

    @Override
    public List<Reply> getRepliesByTime(int page, int limit, String start, String end) {
        return replyMapper.getRepliesByTime((page-1)*limit,limit,start,end);
    }

    @Override
    public void deleteReplyById(int id) {
        replyMapper.deleteReplyById(id);
    }

    @Override
    public int addReply(Reply reply) {
        return replyMapper.addReply(reply);
    }

    @Override
    public void deleteReplyByTopicId(int topicId) {
        replyMapper.deleteReplyByTopicId(topicId);
    }
}
